﻿<cfcomponent>
<cfscript>
DB = 'chinalaohu';
dbt = 'user_concern';
</cfscript>

<!---关注记录总数--->
<cffunction name="mygzrecord" access="public" returntype="string">
<cfquery datasource="#DB#" name="mygzrecord">
SELECT
count(1) as rc
FROM
#dbt#
INNER JOIN auction ON auction.aid = user_concern.aid
WHERE
uid = #uid# AND
auction.atag > 0
</cfquery>
<cfreturn mygzrecord.rc>
</cffunction>

<!---关注LIST--->
<cffunction name="mygzlist" access="public" returntype="string">
  <cfquery datasource="#DB#" name="userconcern">
  select aid
  from user_concern
  where uid = #uid# and aid <> ''
  </cfquery>
  <cfscript>
	if (userconcern.recordcount eq 0){
		gz = 0;
	}
	else {
		gz = valuelist(userconcern.aid);
	}
	return gz;
	</cfscript>
</cffunction>

<cffunction access="public" name="gzlist" returntype="query">
<cfquery datasource="#DB#" name="gzlist">
SELECT
auction.prevtime,
auction.starttime,
auction.endtime,
auction.atag,
auction_gallery.img_waterfall,
auction.aid,
auction.acode,
auction.auction,
if((lastprice=0),1.00,lastprice) as lastprice,
auction.lasttime
FROM
auction
INNER JOIN auction_gallery ON auction_gallery.agid = auction.agid
WHERE atag > 0 
<cfif isdefined('attention') and attention eq 1>
AND auction.aid in (#mygzlist#)
</cfif>
</cfquery>
<cfreturn gzlist>
</cffunction>


</cfcomponent>